Skip to content

[BDMS-264] Expand transfer seeder#227

Merged
jirhiker merged 7 commits into
stagingfrom
TAM-expand-transfer-seed
Nov 4, 2025
Merged

[BDMS-264] Expand transfer seeder#227
jirhiker merged 7 commits into
stagingfrom
TAM-expand-transfer-seed

Conversation

@TylerAdamMartinez

Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem/context:

  • CI Testing will fail without a local DB with some data, and using the transfer script is not practical

How

Implementation summary - the following was changed/added/removed:

  • Use Faker to mock dummy data

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Please take note of the numbers in the code comments. This is how I think each model should be created in order.

@codecov-commenter

codecov-commenter commented Nov 4, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.
see 7 files with indirect coverage changes

Comment thread transfers/seed.py
Comment on lines +13 to +25
# Core models
from db.contact import Contact
from db.location import Location
from db.thing import Thing
from db.sensor import Sensor
from db.deployment import Deployment
from db.sample import Sample
from db.observation import Observation
from db.parameter import Parameter
from db.analysis_method import AnalysisMethod
from db.regulatory_limit import RegulatoryLimit
from db.transducer import TransducerObservation
from db.status_history import StatusHistory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the models are imported into db/__init__.py. To make access to them simpler you could do from db import * (I think). That way we won't have to keep track of them in multiple places.

Comment thread transfers/seed.py Outdated
Comment on lines +66 to +75
# 3. Parameters & Methods
param_names = ["pH", "Temperature", "Conductivity", "TDS", "DO"]
for p in param_names:
prm = Parameter(
parameter_name=p,
matrix="Water",
default_unit="pH units" if p == "pH" else "mg/L",
)
s.add(prm)
parameters.append(prm)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed if MODE=development since setting that environment variable initializes both the parameter and lexicon tables. See core/appy.py

Comment thread transfers/seed.py Outdated
Comment on lines +105 to +107
t.location_associations = [] # placeholder if ORM auto-handles
t.locations.append(loc)
things.append(t)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to associate contacts with things, too, via the ThingContactAssociation model

@jirhiker jirhiker merged commit cba58ca into staging Nov 4, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants